package com.linkoog.devtools.archive.filesystem.tar;

import org.apache.commons.compress.archivers.ArchiveInputStream;
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

/**
 */
public class TarGzFile extends TarFile {

    protected GzipCompressorInputStream _gcInputStream;

    public TarGzFile(File file) {
        super(file);
    }

    @Override
    public ArchiveInputStream getInputStream() throws IOException {
        _fileInputStream = new FileInputStream(_file);

        _gcInputStream = new GzipCompressorInputStream(_fileInputStream);

        return new TarArchiveInputStream(_gcInputStream);
    }

    @Override
    public void close() throws IOException {
        super.close();
        _gcInputStream.close();
    }

}
